@extends("layouts.backend.webadmin")
@section('page-header')
    <h1>
        <small>falw\menu</small>
    </h1>
@endsection

@section('content')
    <link rel="stylesheet" href="{{env('APP_ROOT')}}/assets/select2/css/select2.min.css">
    <link rel="stylesheet" href="{{env('APP_ROOT')}}/assets/select2/css/select2totree.css">
    <!-- Main content -->
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <div class="box-body">
                        @if(count($errors->all()))
                            <ul class="alert alert-danger">
                                @foreach($errors->all() as $error)
                                    <li>{{$error}}</li>
                                @endforeach
                            </ul>
                        @endif
                        <form  method="POST">
                        <div class="form-group">
                            <label for="vulstitle">公告标题</label>
                            <input type="text"  required class="form-control" id="vulstitle" placeholder="公告标题"
                                   name="title" value="{{old('title')}}">
                        </div>
                        <div class="form-group">
                            <label>公告描述</label>
                            <textarea class="form-control" required  rows="3" placeholder="公告描述"
                                      name="description">{{old('description')}}</textarea>
                        </div>
                            <div class="form-group">
                                <label>是否发布</label>
                                <select class="form-control" required  name="is_publish">
                                    <option @if(old('is_publish')==0) selected @endif value="0">暂不发布</option>
                                    <option @if(old('is_publish')==1) selected @endif value="1">立即发布</option>
                                </select>
                            </div>

                        {{--end 新增 漏洞URl、URl参数、payload 三个字段 -end --}}
                        <div class="form-group">
                            <label>公告内容</label>
                            <!-- 加载编辑器的容器 -->
                            <script id="container"  required name="contents" type="text/plain">
                                {{old('contents')}}
                            </script>
                        </div>
                        {!! csrf_field() !!}
                            <button type="submit" class="btn btn-primary">添加</button>
                            </form>
                    </div>
                </div>
            </div>
        </div>
    </section>
@stop
@section('javascript-end')
    <script src="{{env('APP_ROOT')}}/assets/select2/js/select2.min.js"></script>
    <script src="{{env('APP_ROOT')}}/assets/select2/js/select2totree.js"></script>
    @include('UEditor::head');
    <script>
        $(function(){
            $('#vulsCategoryId').select2ToTree({ width: '100%' });
            $('#vulsAppId').select2ToTree({ width: '100%' });
            $('#hiddenStatus').val($("#vulsStatus option:selected").val());
            $('#hiddenUserId').val($("#vulsUserId option:selected").val());
        })
        var toolbars = [[
            'fullscreen', 'source', '|', 'undo', 'redo', '|', 'blockquote', 'forecolor', 'backcolor', 'removeformat', '|',
            'imagenone', 'imageleft',
            'imageright', 'imagecenter', '|', 'link', 'unlink', 'anchor', 'simpleupload', 'insertimage', '|',
        ], [
            'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|','insertcode',
        ]];
        //实例化编辑器
        var ue = UE.getEditor('container', {
            toolbars: toolbars,
            initialFrameHeight: 350,
            serverUrl: "{{env('APP_ROOT')}}"+window.UEDITOR_CONFIG.serverUrl
        });
    </script>
@endsection